﻿Namespace Hash
    Public Class SHA512
        'Public Shared Function ComputeSHA512HashWithProgress(ByVal path As String, ByVal eventTag As Object) As String
        '    Using fs As New System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read)
        '        Return ComputeSHA512Hash(ps)
        '    End Using
        'End Function
        Public Shared Function Compute(ByVal filePath As String) As String
            Using clsFS As New System.IO.FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Delete Or System.IO.FileShare.ReadWrite)
                Return Compute(clsFS)
            End Using
        End Function
        Public Shared Function Compute(ByVal stream As System.IO.Stream) As String
            Dim aHash() As Byte = New System.Security.Cryptography.SHA512Managed().ComputeHash(stream)
            Return System.Convert.ToBase64String(aHash)
        End Function

    End Class
End Namespace